//
//  BetModel.m
//  WanCaiC8
//
//  Created by tangang on 2018/4/26.
//  Copyright © 2018年 tangang. All rights reserved.
//

#import "BetModel.h"
#import "JoinQuizModel.h"
@implementation BetModel

- (void)setSubTime:(NSString *)SubTime{
    NSArray *str=[SubTime componentsSeparatedByString:@"."];
    if (str.count>0) {
        SubTime=str[0];
    }
    str=[SubTime componentsSeparatedByString:@"+"];
    if (str.count>0) {
        SubTime=str[0];
    }
//    NSDate *date=[TGTools dateFormatter:@"yyyy-MM-dd'T'HH:mm:ss" andString:SubTime];
//    _SubTime=[TGTools dateFormatter:@"MM-dd HH:mm" andDate:date];
    _SubTime = [[TGToolForDateFormatter shareInstance] userVisibleDateTimeStringForRFC3339DateTimeString:SubTime];
}

- (void)lottery3DWithData:(NSMutableArray *)dataArr{
    if ([self.BigPlayName isEqualToString:@"第一球"]||[self.BigPlayName isEqualToString:@"第二球"]||[self.BigPlayName isEqualToString:@"第三球"]) {
        for (JoinQuizModel *model in dataArr) {
            if ([model.title isEqualToString:self.BigPlayName]) {
                if ([self.PlayName containsString:@"五码"]) {
                    [model.dataArr replaceObjectAtIndex:0 withObject:self.BetNum];
                }else if ([self.PlayName containsString:@"单双"]){
                    [model.dataArr replaceObjectAtIndex:1 withObject:self.BetNum];
                }else{
                    [model.dataArr replaceObjectAtIndex:2 withObject:self.BetNum];
                }
                break;
            }
        }
    }else{
        for (JoinQuizModel *model in dataArr) {
            if ([model.title isEqualToString:self.BigPlayName]) {
                [model.dataArr replaceObjectAtIndex:0 withObject:self.BetNum];
                break;
            }
            
        }
    }
}

- (void)chromosphereWithData:(NSMutableArray *)dataArr{
    for (JoinQuizModel *model in dataArr) {
        if ([model.title isEqualToString:self.BigPlayName]) {
            [model.dataArr replaceObjectAtIndex:0 withObject:self.BetNum];
            break;
        }
        
    }
}

- (void)sevenStarsWithData:(NSMutableArray *)dataArr{
    for (JoinQuizModel *model in dataArr) {
        if ([model.title isEqualToString:self.BigPlayName]) {
            if ([self.PlayName containsString:@"五码"]) {
                [model.dataArr replaceObjectAtIndex:0 withObject:self.BetNum];
            }else if ([self.PlayName containsString:@"单双"]){
                [model.dataArr replaceObjectAtIndex:1 withObject:self.BetNum];
            }else{
                [model.dataArr replaceObjectAtIndex:2 withObject:self.BetNum];
            }
            break;
        }
    }
}

- (void)bringsWithData:(NSMutableArray *)dataArr{
    for (JoinQuizModel *model in dataArr) {
        if ([model.title isEqualToString:self.BigPlayName]) {
            [model.dataArr replaceObjectAtIndex:0 withObject:self.BetNum];
            break;
        }
        
    }
}

- (void)lotteryWithData:(NSMutableArray *)dataArr{
    for (JoinQuizModel *model in dataArr) {
        if ([model.title isEqualToString:self.BigPlayName]) {
            [model.dataArr replaceObjectAtIndex:0 withObject:self.BetNum];
            break;
        }
        
    }
}

- (void)arrangement3WithData:(NSMutableArray *)dataArr{
    if ([self.BigPlayName isEqualToString:@"第一球"]||[self.BigPlayName isEqualToString:@"第二球"]||[self.BigPlayName isEqualToString:@"第三球"]) {
        for (JoinQuizModel *model in dataArr) {
            if ([model.title isEqualToString:self.BigPlayName]) {
                if ([self.PlayName containsString:@"五码"]) {
                    [model.dataArr replaceObjectAtIndex:0 withObject:self.BetNum];
                }else if ([self.PlayName containsString:@"单双"]){
                    [model.dataArr replaceObjectAtIndex:1 withObject:self.BetNum];
                }else{
                    [model.dataArr replaceObjectAtIndex:2 withObject:self.BetNum];
                }
                break;
            }
        }
    }else{
        for (JoinQuizModel *model in dataArr) {
            if ([model.title isEqualToString:self.BigPlayName]) {
                [model.dataArr replaceObjectAtIndex:0 withObject:self.BetNum];
                break;
            }
            
        }
    }
}

- (void)arrangement5WithData:(NSMutableArray *)dataArr{
    for (JoinQuizModel *model in dataArr) {
        if ([model.title isEqualToString:self.BigPlayName]) {
            if ([self.PlayName containsString:@"五码"]) {
                [model.dataArr replaceObjectAtIndex:0 withObject:self.BetNum];
            }else if ([self.PlayName containsString:@"单双"]){
                [model.dataArr replaceObjectAtIndex:1 withObject:self.BetNum];
            }else{
                [model.dataArr replaceObjectAtIndex:2 withObject:self.BetNum];
            }
            break;
        }
    }
}

- (void)sevenLecaiWithData:(NSMutableArray *)dataArr{
    if ([self.BigPlayName isEqualToString:@"第一球"]||[self.BigPlayName isEqualToString:@"第二球"]||[self.BigPlayName isEqualToString:@"第三球"]||[self.BigPlayName isEqualToString:@"第四球"]||[self.BigPlayName isEqualToString:@"第五球"]||[self.BigPlayName isEqualToString:@"第六球"]||[self.BigPlayName isEqualToString:@"第七球"]) {
        for (JoinQuizModel *model in dataArr) {
            if ([model.title isEqualToString:self.BigPlayName]) {
                if ([self.PlayName containsString:@"单双"]){
                    [model.dataArr replaceObjectAtIndex:0 withObject:self.BetNum];
                }else{
                    [model.dataArr replaceObjectAtIndex:1 withObject:self.BetNum];
                }
                break;
            }
        }
    }else{
        for (JoinQuizModel *model in dataArr) {
            if ([model.title isEqualToString:self.BigPlayName]) {
                [model.dataArr replaceObjectAtIndex:0 withObject:self.BetNum];
                break;
            }
        }
    }
}

- (void)allTimeWithData:(NSMutableArray *)dataArr{
    if ([self.BigPlayName isEqualToString:@"第一球"]||[self.BigPlayName isEqualToString:@"第二球"]||[self.BigPlayName isEqualToString:@"第三球"]||[self.BigPlayName isEqualToString:@"第四球"]||[self.BigPlayName isEqualToString:@"第五球"]) {
        for (JoinQuizModel *model in dataArr) {
            if ([model.title isEqualToString:self.BigPlayName]) {
                if ([self.PlayName containsString:@"五码"]) {
                    [model.dataArr replaceObjectAtIndex:0 withObject:self.BetNum];
                }else if ([self.PlayName containsString:@"单双"]){
                    [model.dataArr replaceObjectAtIndex:1 withObject:self.BetNum];
                }else{
                    [model.dataArr replaceObjectAtIndex:2 withObject:self.BetNum];
                }
                break;
            }
        }
    }else{
        for (JoinQuizModel *model in dataArr) {
            if ([model.title isEqualToString:self.BigPlayName]) {
                if ([self.PlayName containsString:@"单双"]){
                    [model.dataArr replaceObjectAtIndex:0 withObject:self.BetNum];
                }else{
                    [model.dataArr replaceObjectAtIndex:1 withObject:self.BetNum];
                }
                break;
            }
        }
    }
}

- (void)select5WithData:(NSMutableArray *)dataArr{
    if ([self.BigPlayName isEqualToString:@"第一球"]||[self.BigPlayName isEqualToString:@"第二球"]||[self.BigPlayName isEqualToString:@"第三球"]||[self.BigPlayName isEqualToString:@"第四球"]||[self.BigPlayName isEqualToString:@"第五球"]) {
        for (JoinQuizModel *model in dataArr) {
            if ([model.title isEqualToString:self.BigPlayName]) {
                if ([self.PlayName containsString:@"五码"]) {
                    [model.dataArr replaceObjectAtIndex:0 withObject:self.BetNum];
                }else if ([self.PlayName containsString:@"单双"]){
                    [model.dataArr replaceObjectAtIndex:1 withObject:self.BetNum];
                }else{
                    [model.dataArr replaceObjectAtIndex:2 withObject:self.BetNum];
                }
                break;
            }
        }
    }else if ([self.BigPlayName isEqualToString:@"龙虎"]){
        for (JoinQuizModel *model in dataArr) {
            if ([model.title isEqualToString:self.BigPlayName]) {
                [model.dataArr replaceObjectAtIndex:0 withObject:self.BetNum];
                break;
            }
            
        }
    }else{
        for (JoinQuizModel *model in dataArr) {
            if ([model.title isEqualToString:self.BigPlayName]) {
                if ([self.PlayName containsString:@"单双"]){
                    [model.dataArr replaceObjectAtIndex:0 withObject:self.BetNum];
                }else{
                    [model.dataArr replaceObjectAtIndex:1 withObject:self.BetNum];
                }
                break;
            }
        }
    }
}

- (void)nearlyThreeWithData:(NSMutableArray *)dataArr{
    if ([self.BigPlayName isEqualToString:@"和值"]) {
        for (JoinQuizModel *model in dataArr) {
            if ([model.title isEqualToString:self.BigPlayName]) {
                if ([self.PlayName containsString:@"单双"]){
                    [model.dataArr replaceObjectAtIndex:0 withObject:self.BetNum];
                }else{
                    [model.dataArr replaceObjectAtIndex:1 withObject:self.BetNum];
                }
                break;
            }
        }
    }else{
        for (JoinQuizModel *model in dataArr) {
            if ([model.title isEqualToString:self.BigPlayName]) {
                [model.dataArr replaceObjectAtIndex:0 withObject:self.BetNum];
                break;
            }
            
        }
    }
}

- (void)happy10WithData:(NSMutableArray *)dataArr{
    for (JoinQuizModel *model in dataArr) {
        if ([model.title isEqualToString:self.BigPlayName]) {
            if ([self.PlayName containsString:@"球单双"]){
                [model.dataArr replaceObjectAtIndex:0 withObject:self.BetNum];
            }else if ([self.PlayName containsString:@"球大小"]){
                [model.dataArr replaceObjectAtIndex:1 withObject:self.BetNum];
            }else if ([self.PlayName containsString:@"合单双"]){
                [model.dataArr replaceObjectAtIndex:2 withObject:self.BetNum];
            }else if ([self.PlayName containsString:@"尾大小"]){
                [model.dataArr replaceObjectAtIndex:3 withObject:self.BetNum];
            }else if ([self.PlayName containsString:@"龙虎"]){
                [model.dataArr replaceObjectAtIndex:4 withObject:self.BetNum];
            }else if ([self.PlayName containsString:@"东南西北"]){
                [model.dataArr replaceObjectAtIndex:model.dataArr.count-2 withObject:self.BetNum];
            }else{
                [model.dataArr replaceObjectAtIndex:model.dataArr.count-1 withObject:self.BetNum];
            }
            break;
        }
    }
}

- (void)happy12WithData:(NSMutableArray *)dataArr{
    if ([self.BigPlayName isEqualToString:@"第一球"]||[self.BigPlayName isEqualToString:@"第二球"]||[self.BigPlayName isEqualToString:@"第三球"]||[self.BigPlayName isEqualToString:@"第四球"]||[self.BigPlayName isEqualToString:@"第五球"]) {
        for (JoinQuizModel *model in dataArr) {
            if ([model.title isEqualToString:self.BigPlayName]) {
                if ([self.PlayName containsString:@"六码"]) {
                    [model.dataArr replaceObjectAtIndex:0 withObject:self.BetNum];
                }else if ([self.PlayName containsString:@"单双"]){
                    [model.dataArr replaceObjectAtIndex:1 withObject:self.BetNum];
                }else{
                    [model.dataArr replaceObjectAtIndex:2 withObject:self.BetNum];
                }
                break;
            }
        }
    }else if ([self.BigPlayName isEqualToString:@"龙虎"]){
        for (JoinQuizModel *model in dataArr) {
            if ([model.title isEqualToString:self.BigPlayName]) {
                [model.dataArr replaceObjectAtIndex:0 withObject:self.BetNum];
                break;
            }
            
        }
    }else{
        for (JoinQuizModel *model in dataArr) {
            if ([model.title isEqualToString:self.BigPlayName]) {
                if ([self.PlayName containsString:@"单双"]){
                    [model.dataArr replaceObjectAtIndex:0 withObject:self.BetNum];
                }else{
                    [model.dataArr replaceObjectAtIndex:1 withObject:self.BetNum];
                }
                break;
            }
        }
    }
}

- (void)PK10WithData:(NSMutableArray *)dataArr{
    for (JoinQuizModel *model in dataArr) {
        if ([model.title isEqualToString:self.BigPlayName]) {
            if ([self.PlayName containsString:@"五码"]) {
                [model.dataArr replaceObjectAtIndex:0 withObject:self.BetNum];
            }else if ([self.PlayName containsString:@"单双"]){
                [model.dataArr replaceObjectAtIndex:1 withObject:self.BetNum];
            }else if ([self.PlayName containsString:@"大小"]){
                [model.dataArr replaceObjectAtIndex:2 withObject:self.BetNum];
            }else{
                [model.dataArr replaceObjectAtIndex:3 withObject:self.BetNum];
            }
            break;
        }
    }
}

- (NSString *)BetNum{
    if (!_BetNum) {
        _BetNum=@"";
    }
    return _BetNum;
}

@end
